package com.cskaoyan.shopping.converter;

import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.shopping.dal.entitys.Item;
import com.cskaoyan.shopping.dal.entitys.ItemCat;
import com.cskaoyan.shopping.dal.entitys.ItemDesc;
import com.cskaoyan.shopping.dto.ItemAndDescDto;
import com.cskaoyan.shopping.dto.ProductCateDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author why
 * @since 2022/07/30 20:43
 */
@Mapper(componentModel = "spring")
public interface ItemDescConverter {
    @Mappings({
            /*
            i.id as productId,i.price as salePrice,i.title as productName,
i.sell_point as subTitle,i.limit_num as limitNum,i.image as productImageSmall,d.item_desc as detail
             */
            @Mapping(source = "id",target = "productId"),
            @Mapping(source = "price",target = "salePrice"),
            @Mapping(source = "title",target = "productName"),
            @Mapping(source = "sellPoint",target = "subTitle")
    })
    ProductDetailDto item2Dto(Item item);

}
